/*
* Portuguese eID Card API .NET Wrapper
*
* Written by Fernando Nunes (fernando.nunes@devscope.net)
* Copyright (c) 2009 DevScope Information Systems
*
* This library is free software; you can redistribute it and/or 
* modify it under the terms of the GNU Lesser General Public 
* License as published by the Free Software Foundation; either 
* version 2.1 of the License, or (at your option) any later version. 
* 
* This library is distributed in the hope that it will be useful, 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
* Lesser General Public License for more details. 
* 
* You should have received a copy of the GNU Lesser General Public 
* License along with this library; if not, write to the Free Software 
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 
*/ 

#pragma once
#include "pteidlib.h"

using namespace System;

namespace DevScope
{	
	namespace CartaoDeCidadao
	{
		/// <summary>Change Address Operation States</summary>
		public enum class AddressChangeState 
		{
			/// <summary>Initialising</summary>
			INITIALISING			= ADDR_INITIALISING,
			/// <summary>Connecting to the Server (PIN is asked)</summary>
			CONNECTING				= ADDR_CONNECTING,
			/// <summary>Reading info (DH params, ...) from the card</summary>
			READING_INFO			= ADDR_READING_INFO,
			/// <summary>Sending info to the server</summary>
			SENDING_INFO			= ADDR_SENDING_INFO,
			/// <summary>Initialising the secure channel (DH)</summary>
			INIT_SEC_CHANNEL	= ADDR_INIT_SEC_CHANNEL,
			/// <summary>Send challenge to the server</summary>
			SERVER_CHALL			= ADDR_SERVER_CHALL,
			/// <summary>Let the card authenticate the server</summary>
			SERVER_AUTH				= ADDR_SERVER_AUTH,
			/// <summary>Let the server authenticate the card</summary>
			CLIENT_AUTH				= ADDR_CLIENT_AUTH,
			/// <summary>Second authentication of the server (Role Auth.)</summary>
			SERVER_AUTH2			= ADDR_SERVER_AUTH2,
			/// <summary>Write the new Address and SOD to the card</summary>
			WRITE							= ADDR_WRITE,
			/// <summary>Finish the address update (send responses to the server)</summary>
			FINISH						= ADDR_FINISH,
			/// <summary>The Change Address flow has completed</summary>
			FINISHED					= ADDR_FINISHED,
			/// <summary>The Change Address flow was cancelled</summary>
			CANCELLED					= ADDR_CANCELLED
		};

		/// <summary>
		/// Citizen's Address information
		/// </summary>
		/// <remarks>This information can only be retrieved from the card if the Citizen supplies his Address PIN</remarks>
    public ref class Address
    {
		internal:
		  Address(const PTEID_ADDR& i);
      PTEID_ADDR ToUnmanaged();

    public:
			Address();

			short Version;
			String^ AddressType;
			String^ Country;
			String^ District;
			String^ DistrictDescription;
			String^ Municipality;
			String^ MunicipalityDescription;
			String^ Freguesia;
			String^ FreguesiaDescription;
			String^ StreetTypeAbbreviation;
			String^ StreetType;
			String^ Street;
			String^ BuildingAbbreviation;
			String^ Building;
			String^ Door;
			String^ Floor;
			String^ Side;
			String^ Place;
			String^ Locality;
			String^ CP4;
			String^ CP3;
			String^ Postal;
			String^ NumMorada;
			String^ CountryDescriptionF;
			String^ AddressF;
			String^ CityF;
			String^ RegionF;
			String^ LocalityF;
			String^ PostalF;
			String^ NumMoradaF;
    };
	}
}
